package com.csd.action.team;

import com.csd.helper.ActionResult;
import com.csd.serviceImpl.TeamService;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 
 * Action：注册时，检测用户名是否存在 
 * @author csd
 * @version 1.0
 * 
 * <br> 修订时间：2009-12-17
 * <br> 修改原因：创建文件
 * <br> 修改人：刘世彬
 * 
 * <br> 
 * 
 */
public class UserNameCheckAction extends ActionSupport
{
	private String userName;

	private TeamService teamService;
	
	public TeamService getTeamService() {
		return teamService;
	}

	public void setTeamService(TeamService teamService) {
		this.teamService = teamService;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) 
	{
		this.userName = userName.trim();
	}
	
	public String execute(){
		String result = ActionResult.noExist;
		System.out.println(this.userName);
		if(!((this.userName) == null))
		{
			System.out.println("exit");
			if(teamService.checkUserName(this.userName))
			{
				System.out.println("exit45");
				result = ActionResult.isExist;
			}
			else
			{
				System.out.println("存在");
				result = ActionResult.noExist;
			}
		}
		else
		{
			System.out.println("empty");
			result = ActionResult.isEmpty;
		}
		
		return result;
	}
}
